﻿using MediatR;
using W.Purchase.Domain;
using W.Purchase.Read.API.AppLication.Command;
using W.Purchase.Repository.Interface;

namespace W.Purchase.Read.API.AppLication.CommandHandler
{
    public class VendorTypeCommandHandler : IRequestHandler<VendorTypeCommand, List<VendorType>>
    {
        private readonly IVendorTypeRepository vendorTypeRepository;

        public VendorTypeCommandHandler(IVendorTypeRepository vendorTypeRepository)
        {
            this.vendorTypeRepository = vendorTypeRepository;
        }

        public Task<List<VendorType>> Handle(VendorTypeCommand request, CancellationToken cancellationToken)
        {
            return vendorTypeRepository.GetAllAsaync();
        }
    }
}
